package com.study.juc.secstudy;

import java.util.concurrent.TimeUnit;

public class ThreadHook {


    public static void main(String[] args) {


        Runtime.getRuntime().addShutdownHook(new Thread(()->{
            System.out.println("11");
            try {
                TimeUnit.SECONDS.sleep(2L);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        }));

        try {
            TimeUnit.SECONDS.sleep(2L);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }

        System.out.println("结束");

    }
}
